package com.ruoyi.web.domain;

import java.math.BigDecimal;
import java.util.Date;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.utils.StringUtils;
import lombok.*;
import lombok.experimental.Accessors;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 订单列表对象 tb_order
 *
 * @author cacode
 * @date 2024-03-19
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
public class TbOrder extends BaseEntity {

    /**
     * 用户id
     */
    @Excel(name = "用户id")
    private Long userId;

    /**
     * 购物车
     */
    @Excel(name = "购物车")
    private String shopCart;

    /**
     * json的购物车内容
     */
    private JSONArray shopCartJson;

    /**
     * 总金额
     */
    @Excel(name = "总金额")
    private BigDecimal totalPrice;

    /**
     * 状态(0=待支付,1=支付完成待接单,2=接单完成待送达,3=订单完成,4=订单取消)
     */
    @Excel(name = "状态", readConverterExp = "0=待支付,1=支付完成待接单,2=接单完成待送达,3=订单完成,4=订单取消")
    private Integer state;

    /**
     * 备注
     */
    @Excel(name = "备注")
    private String message;

    /**
     * 配送地址
     */
    @Excel(name = "配送地址")
    private String address;

    /**
     * 餐具数量
     */
    @Excel(name = "餐具数量")
    private Integer tablewareNum;

    /**
     * 联系电话
     */
    @Excel(name = "联系电话")
    private String phoneNumber;

    /**
     * 姓名
     */
    @Excel(name = "姓名")
    private String userName;

    /**
     * 性别
     */
    @Excel(name = "性别")
    private Integer sex;
    /**
     * 订单号
     */
    @Excel(name = "订单号")
    private String orderId;
    public void setShopCart(String shopCart) {
        this.shopCart = shopCart;
        System.out.println(shopCart);
        this.setShopCartJson(JSONArray.parse(shopCart));
    }
}
